From: Keir Fraser Date: Thu, 14 Jan 2010 09:44:08 +0000 (+0000) Subject: xend, NUMA: Fix computation of needed nodes X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12740 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=735f8ebd5391b78088335043818e3b4ffa0124a5;p=xen.git xend, NUMA: Fix computation of needed nodes Enumerate the best nodes and add CPU affinity until all VCPUs can be backed by at least one physical core. This should fix problems with asymmetric NUMA configurations and cropped number of CPUs in Xen. Signed-off-by: Andre Przywara --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 1a5ead0d33..6c23fc9be7 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -2724,13 +2724,12 @@ class XendDomainInfo: candidate_node_list.append(i) best_node = find_relaxed_node(candidate_node_list)[0] cpumask = info['node_to_cpu'][best_node] - cores_per_node = info['nr_cpus'] / info['nr_nodes'] - nodes_required = (self.info['VCPUs_max'] + cores_per_node - 1) / cores_per_node - if nodes_required > 1: - log.debug("allocating %d NUMA nodes", nodes_required) - best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes']))) - for i in best_nodes[:nodes_required - 1]: - cpumask = cpumask + info['node_to_cpu'][i] + best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes']))) + for node_idx in best_nodes: + if len(cpumask) >= self.info['VCPUs_max']: + break + cpumask = cpumask + info['node_to_cpu'][node_idx] + log.debug("allocating additional NUMA node %d", node_idx) for v in range(0, self.info['VCPUs_max']): xc.vcpu_setaffinity(self.domid, v, cpumask) return index